package HibernateOrderManagerment.bean;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Table(name="user")
@Entity
public class User {
	@Id
	@Column(name="id")
	private long id;
	@Column(name="username")
	private String username;
	@Column(name="password")
	private String password;
	
	@Column(name="name")
	private String name;
	@Column(name="address")
	private String address;
	@Column(name="phone")
	private String phone;
//	@Column(name="user_status_id")
//	private long userStatusId;
    @ManyToOne
    @JoinColumn(name="user_status_id")
	private UserStatus userStatus;
    @OneToMany
    @JoinColumn(name="user_id")
    private Set<Store> stores;
    @OneToMany
    @JoinColumn(name="customer_id")
    private Set<Orders> orders;
	public User() {
		id=-1;
	}


	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	

	public String getUsername() {
		return username;
	}


	public void setUsername(String username) {
		this.username = username;
	}


	public String getPassword() {
		return password;
	}


	public void setPassword(String password) {
		this.password = password;
	}


	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}



	public UserStatus getUserStatus() {
		return userStatus;
	}


	public void setUserStatus(UserStatus userStatus) {
		this.userStatus = userStatus;
	}
	


	public Set<Store> getStores() {
		return stores;
	}


	public void setStores(Set<Store> stores) {
		this.stores = stores;
	}


	public Set<Orders> getOrders() {
		return orders;
	}


	public void setOrders(Set<Orders> orders) {
		this.orders = orders;
	}


	@Override
	public String toString() {
		return "User [id=" + id + ", name=" + name + ", address=" + address + ", phone=" + phone + ", userStatusId="
				+ userStatus.getId() + "]";
	}


	
}
